<?php
namespace Textblast;
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
require_once 'member.php';
?>
<div id="mainContent">
	<table id="memberGrid"></table>
</div>
<script type="text/javascript">
	var member = {
		addFn: function() {
			alert('add');
			tb.Form({
				renderTo: $('div.flexigrid'),
				title: 'Add Member',
				fields: [{
					field: 'Username',
					name: 'UserName'
				}, {
					field: 'Email',
					name: 'Email'
				}, {
					field: 'First Name',
					name: 'FirstName'
				}, {
					field: 'Middle Name',
					name: 'MiddleName'
				}, {
					field: 'Last Name',
					name: 'LastName'
				}]
			});
		},
		editFn: function() {
			alert('edit');
		},
		deleteFn: function() {
			alert('delete');
		}
	};

	$('#memberGrid').flexigrid({
		title: 'Members',
		url: 'members/get.php',
		method: 'get',
		dataType: 'json',
		query: JSON.stringify({orgID: 2}),
		colModel: [{
			display: '',
			name: 'id',
			width: 7
		}, {
			display: 'Username',
			name: 'UserName',
			width: 100
		}, {
			display: 'Email',
			name: 'Email',
			width: 200
		}, {
			display: 'First Name',
			name: 'FirstName',
			width: 95
		},  {
			display: 'Middle Name',
			name: 'MiddleName',
			width: 95
		}, {
			display: 'Last Name',
			name: 'LastName',
			width: 85
		}, {
			display: 'Joined Date',
			name: 'CreatedDate',
			width: 85
		}],
		width: 800,
		height: 200,
		usepager: true,
		resizable: false,
		rp: 10,
		buttons : [
			{name: 'Add', bclass: 'add', onpress : member.addFn},
			{name: 'Edit', bclass: 'edit', onpress : member.editFn},
			{name: 'Delete', bclass: 'delete', onpress : member.deleteFn},
			{separator: true}
		]
	});
</script>